# -*- encoding: utf-8 -*-
import logging

from django.core.mail import send_mail

from celery_tasks.main import app
from meiduo_mall import settings

logger = logging.getLogger('django')


@app.task
def celery_send_email(subject, message, from_email, recipient_list, html_message):

    try:
        logging.info(html_message)
        send_mail(subject=subject,
                  message=message,
                  from_email=from_email,
                  recipient_list=recipient_list,
                  html_message=html_message)
    except Exception as e:
        logging.error(e)

